<?php
	include "../../functions.php";
	//加载商品数据库
	$data = include "goodsdb.php";
	//新增商品点击数为1
	$_POST['click']=1;
	//将新商品压入商品数据库
	$data[]=$_POST;

	header("Content-type:text/html;charset=utf-8");
	//将商品数据写入数据库文件中，做持久保存
	if(file_put_contents("goodsdb.php","<?php \nreturn ".var_export($data,true).";\n?>")){
		echo '<script>alert("商品添加成功");
		location.href="list.php";
		</script>';
	}
?>